package com.gavinnie.Test;

import java.io.IOException;
import java.net.CookieHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.gavinnie.util.CookieUtil;

/**
 * Servlet implementation class saveAction
 */
public class saveAction extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		String checkbox = request.getParameter("checkbox");
		
		//验证码
		//密码是否正确
		
		//添加是否自动保存用户名密码
		CookieUtil.addCookie(username, password, checkbox, request, response);
		//跳转
		request.getRequestDispatcher("/success.jsp").forward(request, response);
	}

}
